<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/******************************************************
* Profile			: article 
* Author			: 乔伟
* Create Time		: 2011-10-05 
* Modify Time		: 2011-10-05 
* Modify Profile	:  
******************************************************/
class page extends Front_Controller {

    public function index($id=null){
        echo $id;
    }
	/******************************************************
	* Profile			: 显示
	* Author			: 乔伟
	* Create Time		: 2011-10-05 
	* Modify Time		: 2011-10-05 
	* Modify Profile	:  
	******************************************************/
	public function show($id = null)
	{
        $id = $cache_key = empty($_GET['id'])?$id:$this->input->get('id');

        $this->load->model('menu_manager');
        $this->load->model('page_manager');
        $this->load->model('page_class_manager');

        // exit("aa");
		if($id!=null)
		{
			$page = $this->page_manager->get($id); 
		}  
		else
		{
			$page = $this->page_manager->get(array('alias'=>$this->input->get('alias'))); 
		}       


		$tpl_show = "v_show";
		$part_template =  $page->part_template;
		if(!empty($part_template) &&
				file_exists(APPPATH."views/".$this->template."/".CONTROL_FOLDER."/page/v_".$part_template."_show.php"))
		{
			$tpl_show = "v_".$part_template."_show"; 
		}
		
		$page_html = $this->load->view("front/page/$tpl_show",array('page'=>$page),true);
        $this->cache->save('page-show-'.$id, $page_html, 3600*24*30);
        echo $page_html;
	}
}
